home *** CD-ROM | disk | FTP | other *** search
/ PC Media 2 / PC MEDIA CD02.iso / share / os2 / mgaii_11 / install.cmd next >
Encoding:
Text File  |  1994-02-17  |  6.9 KB  |  283 lines

  1. /*MGA OS/2 PM drivers installation batch file*/
  2.  
  3. '@ECHO OFF'
  4.  
  5. Srcdrv = 'A:'
  6. Dstdrv = 'C:'
  7. Windrv = 'C:'
  8. WinExt= 'WOS'       /* assumes regular WinOS2 */
  9. CurDir=directory()
  10.  
  11. /********************************************************************/
  12. /* Seach for Installation disk                        */
  13. /********************************************************************/
  14.  
  15. FileName='A:\OS2\MGA8.DSC'
  16. Ret = stream(FileName, 'C', 'query exists')
  17. if Ret = "" then do
  18.     FileName='B:\OS2\MGA8.DSC'
  19.     Ret = stream(FileName, 'C', 'query exists')
  20.     if Ret = "" then nop
  21.     else Srcdrv = 'B:'
  22. end
  23.  
  24. /********************************************************************/
  25. /* Seach for OS2 system files and Windows path in PATH environement */
  26. /********************************************************************/
  27.  
  28. env = 'OS2ENVIRONMENT'
  29. Path = value('PATH',,env)
  30. if Path = '' then signal ENDSEARCH
  31.  
  32. ntmp = pos(':\OS2;', Path)
  33. if ntmp = 0 then signal ENDSEARCH
  34.  
  35. Dstdrv=substr(Path, ntmp-1,2)
  36. Windrv=Dstdrv
  37. WinDir=Windrv'\OS2\MDOS\WINOS2'     /* default value */
  38.  
  39. ntmp = pos(':\OS2\MDOS\WINOS2', Path)
  40. if ntmp > 0 then do
  41.     Windrv=substr(Path, ntmp-1,2)
  42.     WinDir=substr(Path, ntmp-1,18)
  43.     signal ENDSEARCH
  44. end
  45.  
  46. ntmp = pos(':\WINDOWS', Path)
  47. if ntmp > 0 then do
  48.     Windrv=substr(Path, ntmp-1,2)
  49.     WinDir=substr(Path, ntmp-1,10)
  50.     signal ENDSEARCH
  51. end
  52.  
  53. ntmp = pos(':\WIN31', Path)
  54. if ntmp > 0 then do
  55.     Windrv=substr(Path, ntmp-1,2)
  56.     WinDir=substr(Path, ntmp-1,8)
  57.     signal ENDSEARCH
  58. end
  59.  
  60. ENDSEARCH:
  61.  
  62. /*************/
  63.  
  64.  
  65. Parse Arg all
  66. If words(all) < 2 then
  67.     signal resume
  68. else do
  69.     Srcdrv = translate(word(all,1))
  70.     Dstdrv = translate(word(all,2))
  71.     select
  72.     when Srcdrv = 'A:' then nop
  73.     when Srcdrv = 'B:' then nop
  74.     otherwise signal usage
  75.     end
  76.     signal resume
  77. end
  78.  
  79. RESUME:
  80. cls
  81. say ''
  82. say ''
  83. say 'Source drive will be:' Srcdrv
  84. say 'Destination drive will be:' Dstdrv
  85. say 'Win/OS2 or Windows Directory is:' WinDir
  86. say 'Is the above information correct? (Y/N): Y'
  87. pull answer
  88. if answer = 'N' then signal askdrives
  89.  
  90. FileName=Srcdrv'\OS2\MGA8.DSC'
  91. Ret = stream(FileName, 'C', 'query exists')
  92. if Ret = "" then signal usage0
  93.  
  94. FileName=Dstdrv'\OS2KRNL'
  95. 'attrib -r -s -h 'FileName
  96. Ret = stream(FileName, 'C', 'query exists')
  97. if Ret = "" then signal usage0
  98. 'attrib +h +s +r 'FileName
  99.  
  100. NewDir=directory(WinDir)
  101.  
  102. if NewDir=WinDir then do
  103.     test='ok'
  104.     FileName=WinDir'\SYSTEM.INI'
  105.     Ret = stream(FileName, 'C', 'query exists')
  106.     if Ret = "" then test='fail'
  107.     FileName=WinDir'\WIN.COM'
  108.     Ret = stream(FileName, 'C', 'query exists')
  109.     if Ret = "" then test='fail'
  110. end
  111.  
  112. if test='ok' then signal OK
  113.  
  114. askagain:
  115.  
  116. say 'Do you have OS/2 for Windows? (Y/N): N'
  117. pull answer
  118. if answer = 'Y' then do
  119.     say 'Enter directory of Windows 3.1 ('Windrv'\WINDOWS)'
  120.     pull answer
  121.     if answer = '' then WinDir=Windrv'\WINDOWS'
  122.     else WinDir=answer
  123.     if directory(WinDir) = '' then do
  124.     say WinDir ' does not exist'
  125.     say 'Do you want to exit and check again? (Y/N): N'
  126.     pull answer
  127.     if answer = 'Y' then signal end
  128.     else signal askagain
  129.     end
  130.     else WinExt='WIN'       /* OS2 for Windows*/
  131. end
  132. else do /*(WINOS2)*/
  133.     say 'Did you install WINOS2 on a different drive? (Y/N): Y'
  134.     pull answer
  135.     if answer='N' then do
  136.     say WinDir ' not found but we will install WinOS2 drivers to 'WinDir ' anyway.'
  137.     end
  138.     else do
  139.     say 'Enter drive where WinOS2 was installed ('Windrv')'
  140.     pull answer
  141.     if answer = '' then WinDir=Windrv'\OS2\MDOS\WINOS2'
  142.     else WinDir=answer'\OS2\MDOS\WINOS2'
  143.     if directory(WinDir) = '' then do
  144.         say WinDir ' does not exist'
  145.         say 'Do you want to exit and check again? (Y/N): N'
  146.         pull answer
  147.         if answer = 'Y' then signal end
  148.         else signal askagain
  149.     end
  150.     end
  151. end
  152. signal resume
  153.  
  154. OK:
  155.  
  156. say 'Source Directory will be 'Srcdrv'\OS2'
  157. say 'Win/OS2 drivers will be installed on 'Windir'\SYSTEM'
  158. say 'Ready to install? (Y/N): Y'
  159. pull answer
  160. if answer = '' then signal OK1
  161. if answer = 'Y' then signal OK1
  162. say 'INSTALLATION ABORT'
  163. signal end
  164.  
  165. OK1:
  166. say 'PLEASE WAIT ...'
  167.  
  168. NewDir=directory(Dstdrv'\')             /* go to root off OS/2 drive */
  169.  
  170. /********************************************/
  171. /* remove any MGA statement from CONFIG.SYS */
  172. /********************************************/
  173.  
  174. InnF=Dstdrv'\CONFIG.MGA'
  175. OutF=Dstdrv'\CONFIG.SYS'
  176. 'copy 'OutF' 'InnF' >nul'
  177. 'del 'OutF
  178.  
  179. do until lines(InnF) = 0
  180.     InStr = linein(InnF)
  181.     select
  182.     when pos('MGAKRNL.SYS', InStr) > 0  then nop
  183.     when pos('VVGA.SYS', InStr) > 0  then nop
  184.     when pos('VSVGA.SYS', InStr) > 0  then nop
  185.     when pos('MGA=', InStr) > 0        then nop
  186.     when pos('MGARES=', InStr) > 0        then nop
  187.     when pos('VIO_MGA', InStr) > 0        then nop
  188.     when pos('RAMBIOS.SYS', InStr) > 0  then nop
  189.     when pos('VMGA.SYS', InStr) > 0     then nop
  190.     otherwise
  191.     do
  192.         if pos('LIBPATH=', InStr) > 0   then    do
  193.         itmp = pos(':\MGA\OS2', InStr)
  194.         if itmp > 0 then stmp=delstr(InStr, itmp-1, 11)
  195.         else stmp=InStr
  196.         call lineout OutF, stmp
  197.         end
  198.         else do
  199.         itmp = pos(':\MGA\OS2', InStr)
  200.         if itmp = 0 then  call lineout OutF, InStr
  201.                 end
  202.     end
  203.     end
  204. end
  205.  
  206. call stream OutF, 'c', 'close'
  207. call stream InnF, 'c', 'close'
  208.  
  209. /**********************************/
  210. /* add fixvga.exe to AUTOEXEC.BAT */
  211. /**********************************/
  212.  
  213. InnF=Dstdrv'\AUTOEXEC.MGA'
  214. OutF=Dstdrv'\AUTOEXEC.BAT'
  215. 'copy 'OutF' 'InnF' >nul'
  216. 'del 'OutF
  217.  
  218. call lineout OutF, '@ECHO OFF'
  219. call lineout OutF, Dstdrv'\MGA\OS2\FIXVGA.EXE'
  220. call lineout OutF, Dstdrv'\OS2\MODE CO80'
  221. do until lines(InnF) = 0
  222.     InStr = linein(InnF)
  223.     select
  224.     when pos('ECHO OFF', InStr) > 0         then nop
  225.     when pos('FIXVGA.EXE', InStr) > 0 then nop
  226.     when pos(':\OS2\MODE CO80', InStr) > 0        then nop
  227.     otherwise call lineout OutF, InStr
  228.     end
  229. end
  230.  
  231. call stream OutF, 'c', 'close'
  232. call stream InnF, 'c', 'close'
  233.  
  234.  
  235. /**********************************/
  236. /* Call OS/2 Installation process */
  237. /**********************************/
  238.  
  239. NewDir=directory(Dstdrv'\OS2\INSTALL')
  240. 'unpack 'Srcdrv'\OS2\MGAINSTL.DL@ .>nul'
  241. 'copy 'Srcdrv'\OS2\MGA8.DSC .>nul'
  242.  
  243. if WinExt='WOS' then OthExt='WIN'
  244. else                             OthExt='WOS'
  245.  
  246. 'SET WINMGA='WinDir
  247. NewDir=directory(WinDir'\SYSTEM')
  248. 'call 'Srcdrv'\OS2\DRVPMI.CMD 'Dstdrv' 'WinDir' 'WinExt' 'OthExt
  249. 'SET WINMGA='
  250.  
  251. signal end
  252.  
  253. ASKDRIVES:
  254. say 'Enter source drive ('Srcdrv')'
  255. pull answer
  256. if   answer = "" then nop
  257. else Srcdrv = answer
  258. say 'Enter destination drive ('Dstdrv')'
  259. pull answer
  260. if   answer = "" then nop
  261. else Dstdrv = answer
  262. signal askagain
  263.  
  264. USAGE0:
  265. say 'File' FileName ' does not exist'
  266. USAGE:
  267. say ''
  268. say 'Usage:'
  269. say '   install src: dst:'
  270. say '   Where src is the drive from which you are installing the driver'
  271. say '   and dst is your OS/2 boot drive.'
  272. say 'Example:'
  273. say '   b:install b: d:'
  274. say '   a:install'
  275.  
  276. end:
  277. call directory CurDir
  278. exit
  279.  
  280.  
  281.  
  282.  
  283.